/**
 * 
 */
package pacMan;

import java.awt.Graphics2D;

/**
 * Class: BonusItem
 * 
 * Manages bonus item that appears at center of game board at
 * random intervals.
 * 
 * @author 		Tomas Rivera
 * @version 	$Id$
 *
 */
public class BonusItem extends ConsumableObject {
	
	//////////////////////////////////////////////////////////
	// Constructor methods
	//////////////////////////////////////////////////////////
	
	/**
	 * Creates BonusItem object that will be drawn on-screen.
	 * 
	 * @param c
	 * @param w
	 */
	public BonusItem(Coordinate c, WindowParameters w) {
		super(c, w, ScoreTracker.CHERRIES_PV);
		c.changePosition(this.getObjectLocation().getX() + (this.getWindowParams().getPixelScale() / 2), this.getObjectLocation().getY());
		hide();
	}
	
	//////////////////////////////////////////////////////////
	// Public methods
	//////////////////////////////////////////////////////////
	
	/**
	 * Updates point value, which is used to determine what shape we draw
	 * on-screen and how much the player earns for consuming it.
	 * 
	 * @param round
	 */
	public void reset(int round) {
		switch(round) {
			case 1:
				updatePointValue(ScoreTracker.CHERRIES_PV);
				break;
			case 2:
				updatePointValue(ScoreTracker.STRAWBERRY_PV);
				break;
				
			case 3:
			case 4:
				updatePointValue(ScoreTracker.PEACH_PV);
				break;
				
			case 5:
			case 6:
				updatePointValue(ScoreTracker.APPLE_PV);
				break;
				
			case 7:
			case 8:
				updatePointValue(ScoreTracker.GRAPES_PV);
				break;
				
			case 9:
			case 10:
				updatePointValue(ScoreTracker.GALAXIAN_PV);
				break;
				
			case 11:
			case 12:
				updatePointValue(ScoreTracker.BELL_PV);
				break;
				
			default:
				updatePointValue(ScoreTracker.KEY_PV);
				break;
		}
		
		hide();
	}
	
	//////////////////////////////////////////////////////////
	// Overridden methods
	//////////////////////////////////////////////////////////
	
	/* (non-Javadoc)
	 * @see pacMan.ConsumableObject#consumeObject(pacMan.Actor)
	 */
	@Override
	public void consumeObject(Actor consumer) {
		if(visible()) {
			consumer.addToScore(getPointValue(), false);
			SoundEffect.EVENT_PACMAN_EATBONUS.play();
			hide();
		}
	}
	
	/*
	 * (non-Javadoc)
	 * @see pacMan.BasicDrawableObject#drawObject(java.awt.Graphics2D)
	 */
	@Override
	public void drawObject(Graphics2D d) {
		if(visible()) {
			switch(getPointValue()) {
				case ScoreTracker.CHERRIES_PV:
					break;
				
				case ScoreTracker.STRAWBERRY_PV:
					break;
					
				case ScoreTracker.PEACH_PV:
					break;
					
				case ScoreTracker.APPLE_PV:
					break;
					
				case ScoreTracker.GRAPES_PV:
					break;
					
				case ScoreTracker.GALAXIAN_PV:
					break;
					
				case ScoreTracker.BELL_PV:
					break;
					
				default:
					// ScoreTracker.KEY_PV
					
					break;
			}
		}

	}

	/*
	 * (non-Javadoc)
	 * @see pacMan.BasicDrawableObject#resizeObject()
	 */
	@Override
	public void resizeObject() {
		// TODO Auto-generated method stub

	}
	

	//////////////////////////////////////////////////////////
	// Private member variables
	//////////////////////////////////////////////////////////


}
